package com.atguigu.chaptar3

object $11_ManyTraitExtends {
  trait Log{
    //具体属性
    val name = "lisi"
    //抽象属性
    val age:Int
    //抽象方法
    def add(x:Int,y:Int):Int
    //具体方法
    def printHello() = println("hello.....")
  }
  trait Parent{
    def add(x:Int,y:Int)={
      println("parent")
      x*x+y*y
    }
  }
  trait Log1 extends Parent {
    override def add(x:Int,y:Int)={
      println("log1")
     // super.add(x,y)
      x+y
    }
  }
  trait Log2 extends Parent{
    override def add(x:Int,y:Int)={
      println("log2")
      super.add(x,y)
    }
  }
  trait Log3 extends Parent{
    override def add(x:Int,y:Int)={
      println("log3")
      super.add(x,y)
    }
  }
  class Son extends Log1 with Log2 with Log3{
   override def add(x:Int,y:Int)= {
    println("son")
     super.add(x,y)
   }}



  def main(args: Array[String]): Unit = {
    val son = new Son
    son.add(3, 5)
  }
}
